export const swaggerDocument = {
  openapi: '3.0.0',
  info: {
    title: '讲课APP API文档',
    version: '1.0.0',
    description: '讲课APP后端服务API文档'
  },
  servers: [
    {
      url: 'http://localhost:3000',
      description: '开发服务器'
    }
  ],
  paths: {
    '/api/user/login': {
      post: {
        tags: ['用户'],
        summary: '用户登录',
        requestBody: {
          content: {
            'application/json': {
              schema: {
                type: 'object',
                properties: {
                  username: {
                    type: 'string'
                  },
                  password: {
                    type: 'string'
                  }
                }
              }
            }
          }
        },
        responses: {
          200: {
            description: '登录成功'
          }
        }
      }
    },
    '/api/user/register': {
      post: {
        tags: ['用户'],
        summary: '用户注册',
        requestBody: {
          content: {
            'application/json': {
              schema: {
                type: 'object',
                properties: {
                  username: {
                    type: 'string',
                    description: '用户名'
                  },
                  password: {
                    type: 'string',
                    description: '密码'
                  },
                  name: {
                    type: 'string',
                    description: '姓名'
                  },
                  email: {
                    type: 'string',
                    description: '邮箱'
                  }
                },
                required: ['username', 'password', 'email']
              }
            }
          }
        },
        responses: {
          200: {
            description: '注册成功'
          },
          400: {
            description: '参数错误'
          }
        }
      }
    },
    '/api/courses': {
      get: {
        tags: ['课程'],
        summary: '获取课程列表',
        responses: {
          200: {
            description: '成功获取课程列表',
            content: {
              'application/json': {
                schema: {
                  type: 'object',
                  properties: {
                    data: {
                      type: 'array',
                      items: {
                        $ref: '#/components/schemas/Course'
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    '/api/courses/{id}': {
      get: {
        tags: ['课程'],
        summary: '获取课程详情',
        parameters: [
          {
            name: 'id',
            in: 'path',
            required: true,
            schema: {
              type: 'integer'
            },
            description: '课程ID'
          }
        ],
        responses: {
          200: {
            description: '成功获取课程详情',
            content: {
              'application/json': {
                schema: {
                  $ref: '#/components/schemas/CourseDetail'
                }
              }
            }
          }
        }
      }
    },
    '/api/courses/search': {
      get: {
        tags: ['课程'],
        summary: '搜索课程',
        parameters: [
          {
            name: 'q',
            in: 'query',
            required: true,
            schema: {
              type: 'string'
            },
            description: '搜索关键词'
          }
        ],
        responses: {
          200: {
            description: '搜索结果',
            content: {
              'application/json': {
                schema: {
                  type: 'object',
                  properties: {
                    data: {
                      type: 'array',
                      items: {
                        $ref: '#/components/schemas/Course'
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    '/api/courses/favorite': {
      post: {
        tags: ['课程'],
        summary: '收藏/取消收藏课程',
        requestBody: {
          content: {
            'application/json': {
              schema: {
                type: 'object',
                properties: {
                  courseId: {
                    type: 'integer',
                    description: '课程ID'
                  }
                },
                required: ['courseId']
              }
            }
          }
        },
        responses: {
          200: {
            description: '操作成功'
          }
        }
      }
    },
    '/api/user/info': {
      get: {
        tags: ['用户'],
        summary: '获取用户信息',
        responses: {
          200: {
            description: '成功获取用户信息',
            content: {
              'application/json': {
                schema: {
                  type: 'object',
                  properties: {
                    data: {
                      type: 'object',
                      properties: {
                        id: { type: 'integer' },
                        username: { type: 'string' },
                        name: { type: 'string' },
                        email: { type: 'string' }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      put: {
        tags: ['用户'],
        summary: '更新用户信息',
        requestBody: {
          content: {
            'application/json': {
              schema: {
                type: 'object',
                properties: {
                  name: { type: 'string' },
                  email: { type: 'string' }
                }
              }
            }
          }
        },
        responses: {
          200: {
            description: '更新成功'
          }
        }
      }
    },
    '/api/teachers': {
      get: {
        tags: ['讲师'],
        summary: '获取讲师列表',
        responses: {
          200: {
            description: '成功获取讲师列表',
            content: {
              'application/json': {
                schema: {
                  type: 'object',
                  properties: {
                    data: {
                      type: 'array',
                      items: {
                        $ref: '#/components/schemas/Teacher'
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    '/api/teachers/{id}': {
      get: {
        tags: ['讲师'],
        summary: '获取讲师详情',
        parameters: [
          {
            name: 'id',
            in: 'path',
            required: true,
            schema: {
              type: 'integer'
            },
            description: '讲师ID'
          }
        ],
        responses: {
          200: {
            description: '成功获取讲师详情'
          }
        }
      }
    },
    '/api/teachers/{id}/courses': {
      get: {
        tags: ['讲师'],
        summary: '获取讲师课程列表',
        parameters: [
          {
            name: 'id',
            in: 'path',
            required: true,
            schema: {
              type: 'integer'
            },
            description: '讲师ID'
          }
        ],
        responses: {
          200: {
            description: '成功获取讲师课程列表'
          }
        }
      }
    }
  },
  components: {
    schemas: {
      Course: {
        type: 'object',
        properties: {
          id: { type: 'integer' },
          title: { type: 'string' },
          description: { type: 'string' },
          teacherId: { type: 'integer' },
          price: { type: 'number' },
          duration: { type: 'integer' },
          category: { type: 'string' },
          tags: { 
            type: 'array',
            items: { type: 'string' }
          },
          createdAt: { type: 'string', format: 'date-time' },
          updatedAt: { type: 'string', format: 'date-time' }
        }
      },
      CourseDetail: {
        allOf: [
          { $ref: '#/components/schemas/Course' },
          {
            type: 'object',
            properties: {
              chapters: {
                type: 'array',
                items: {
                  type: 'object',
                  properties: {
                    id: { type: 'integer' },
                    title: { type: 'string' },
                    content: { type: 'string' },
                    duration: { type: 'integer' }
                  }
                }
              }
            }
          }
        ]
      },
      Teacher: {
        type: 'object',
        properties: {
          id: { type: 'integer' },
          name: { type: 'string' },
          title: { type: 'string' },
          avatar: { type: 'string' },
          description: { type: 'string' },
          expertise: {
            type: 'array',
            items: { type: 'string' }
          },
          rating: { type: 'number' },
          studentCount: { type: 'integer' }
        }
      }
    }
  }
};
